﻿using AutoMapper;
using NET6.WebAPI.Entities.Product;
using NET6.WebAPI.Reqs.Product;
using static NET6.WebAPI.Entities.Base.BusinessBase;
using static NET6.WebAPI.Entities.Base.ExamineBase;

namespace NET6.WebAPI.Profiles
{
    public class ProductProfile : Profile
    {
        public ProductProfile()
        {
            CreateMap<Sys_BrandAddReq, Sys_Brand_Examine>()
                .ForMember(dest => dest.SubmitTime, opt => opt.MapFrom(src => DateTime.Now))
                .ForMember(dest => dest.ExamineType, opt => opt.MapFrom(src => ExamineTypeEnum.Add))
                .ForMember(dest => dest.ExamineStatus, opt => opt.MapFrom(src => ExamineStatusEnum.PendingApproval));

            CreateMap<Sys_BrandModifyReq, Sys_Brand_Examine>()
                .ForMember(dest => dest.SubmitTime, opt => opt.MapFrom(src => DateTime.Now))
                .ForMember(dest => dest.ExamineType, opt => opt.MapFrom(src => ExamineTypeEnum.Modify))
                .ForMember(dest => dest.ExamineStatus, opt => opt.MapFrom(src => ExamineStatusEnum.PendingApproval))
                .ForMember(dest => dest.BusinessID, opt => opt.MapFrom(src => src.ID));

            CreateMap<Sys_Brand, Sys_Brand_Examine>()
                .ForMember(dest => dest.SubmitTime, opt => opt.MapFrom(src => DateTime.Now))
                .ForMember(dest => dest.ExamineStatus, opt => opt.MapFrom(src => ExamineStatusEnum.PendingApproval))
                .ForMember(dest => dest.BusinessID, opt => opt.MapFrom(src => src.ID));

            CreateMap<Sys_Brand_Examine, Sys_Brand>()
                .ForMember(dest => dest.RecordStatus, opt => opt.MapFrom(src => RecordStatusEnum.Active))
                .ForMember(dest => dest.ID, opt => opt.Ignore());
        }
    }
}
